package com.qf.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RedissonConfig {

    @Bean
    public RedissonClient redissonClient() {

        Config config = new Config();
        config.
                useSingleServer() // 使用单体
                .setAddress("redis://2102.com:6379") // 协议需要使用reids
                .setPassword("root"); // 设置密码

        // 3.创建redisClient
        RedissonClient redissonClient = Redisson.create(config);
        return redissonClient;
    }
}
